# -*- coding: utf-8 -*-
import csv
class DoubanscrapyPipeline(object):
    file_path = "douban_book.csv"
    def __init__(self):
        self.article = open(self.file_path, "a+", encoding="utf-8")
     # 保存每个item对象的方法
    def process_item(self, item, spider):
        title=item['title']
        author=item['author']
        publisher=item['publisher']
        publishTime=item['publishTime']
        price= item['price']
        rate=item['rate']
        commentsNum=item['commentsNum']
        list1= ["title","author","publisher","publishTime","price","rate","commentsNum"]
        self.article.write(list1)
        
        return item
     
